﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using SSS.DB;

namespace DBTest
{
    /// <summary>
    /// Interaktionslogik für MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        DBAccess db = new DBAccess();
        public MainWindow()
        {
            
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            
            String ergebnis;
            ergebnis = db.getSize(1,"1");
            label1.Content = "ergebnis:"+ergebnis;

        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            SSS.Classes.Customer customer = new SSS.Classes.Customer();
            customer.Prename = "Max";
            customer.Name = "Mustermann";
            customer.Beinlaenge = 100;
            customer.Armlaenge = 50;
            //MessageBox.Show("leere kundenid: "+customer.KundenID);
            int neueKundenId;
            neueKundenId=db.saveCustomer(customer);
            label1.Content = "neue KundenId: " + neueKundenId;
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            SSS.Classes.Customer customer = new SSS.Classes.Customer();
            customer = db.getCustomer(1);
            customer.Prename ="Hans";
            customer.Name = "ImGlück";
            int neueKundenId;
            neueKundenId = db.saveCustomer(customer);
            label1.Content = "aktualisierte KundenId: " + neueKundenId;
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            String pID;
            pID=db.getProductIDfromReader(4355);
            label1.Content = "Reader 4355 hat PID " + pID;
        }
    }
}
